home *** CD-ROM | disk | FTP | other *** search
- Path: gabi-soft.fr!usenet
- From: kanze@gabi.gabi-soft.fr (J. Kanze)
- Newsgroups: comp.lang.c++
- Subject: Re: Bug or Feature? const int variables do not export in gcc 2.7.0
- Followup-To: comp.lang.c++
- Date: 12 Feb 1996 10:37:52 GMT
- Organization: GABI Software, Sarl.
- Message-ID: <KANZE.96Feb12113753@gabi.gabi-soft.fr>
- References: <4fdlee$bpf@netlab.cs.rpi.edu>
- NNTP-Posting-Host: gabi.gabi-soft.fr
- In-reply-to: ivo.welch@AGSM.UCLA.EDU's message of 8 Feb 1996 20:11:58 -0000
-
- In article <4fdlee$bpf@netlab.cs.rpi.edu> ivo.welch@AGSM.UCLA.EDU (Ivo
- Welch) writes:
-
- > On a NextStep/FIP system w/ gcc 2.7.0:
- >
- > File try2.cc:
- > int ex1=2;
- >
- > File try1.cc:
- > extern "C" {
- > #include <stdio.h>
- > }
- >
- > int main() {
- > extern int ex1; printf("Extern = %d\n", ex1); return 0; }
- >
- > works, but if I replace "int" with "const int" in both situations, the
- > linker complains that ex1 is not defined. NOTE that it works with "const"
- > in gcc if instead of C++ I switch to plain C.
-
- This is as it should be. The implicit linkage for const is static (in
- C++, but not in C). Just insert the keywork extern in front of the
- declaration.
-
- --
- James Kanze (+33) 88 14 49 00 email: kanze@gabi-soft.fr
- GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
- Conseils, Θtudes et rΘalisations en logiciel orientΘ objet --
- -- A la recherche d'une activitΘ dans une region francophone
-